<?php

/**
 * Description of CatList
 *
 * @author gun
 */
class CHelper_Controller_Helper_CatList extends Zend_Controller_Action_Helper_Abstract {
    
    public function CatList($data = array(), $selected = '') {
        $tmp = $merge = array();
        array_unshift( $merge, '<option value="">-- Pilih --</option>' );

        foreach ($data as $value) {
            $tmp = array_values($value);
            $merge[] = '<option value="'. $tmp[0] .'"'. 
                    ((0 !== strlen($selected) && $selected === $tmp[0]) ? 
                    'selected="selected"' : '') .'>' . $tmp[1] . '</option>';
        }
        
        return $merge;
    }
    
    public function direct($data = array(), $selected = '') {
        return $this->CatList($data, $selected);
    }
}
